package com.alit.face.koala.service.api;

import com.alit.face.koala.app.data.*;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by liotng on 2019/9/21.
 */
@Service
public class UserService {
  public AppResponse user() {
    AppResponse retval = new AppResponse();
    retval.setCode(0);
    retval.setData(getData());
    retval.setPage(new Page());
    return retval;
  }

  private UserData getData() {
    UserData retval = new UserData();
    retval.setAvatar("");
    retval.setCompany(getCompany());
    retval.setOrganization_id(0);
    retval.setPassword_reseted(true);
    retval.setPermission(new ArrayList<>(0));
    Role role=new Role();
    role.setAdmin(null);
    role.setId(0);
    role.setName(null);
    role.setRoot(null);
    retval.setRole(role);

    retval.setRole_id(2);
    retval.setServer_version("3.1.0.88");
    retval.setUsername("test@123456.com");
    retval.setVerify(false);
    return retval;
  }

  private Company getCompany() {
    Company retval = new Company();
    retval.setAttendance_on(false);
    List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
    retval.setAttendance_weekdays(list);

    retval.setConsigner("联想桥");
    retval.setCreate_time(1566985533);
    retval.setData_version(1);
    retval.setDeployment("1");
    retval.setDoor_range(getDoor_range());
    retval.setDoor_weekdays(list);
    retval.setFeature_version(7);
    retval.setFmp_on(false);
    retval.setFull_day(false);
    retval.setId(1);
    retval.setLang_code("zh-Hans");
    retval.setLogo("/static/images/logo.png");
    retval.setName("联想桥");
    retval.setNotdetermined_on(true);
    retval.setOrganization(null);
    retval.setRemark("");
    retval.setScenario("正常使用");
    retval.setUpload(true);
    retval.setYellowlist_warn(false);
    return retval;
  }

  private List<List<Integer>> getDoor_range() {
    List<List<Integer>> retval = new ArrayList<>(
      Arrays.asList(new ArrayList<>(Arrays.asList(9, 0)), new ArrayList<>(Arrays.asList(21, 0)))
    );
    return retval;
  }
}